package com.neusoft.yuejian12.yuejian_12.model;

import com.neusoft.yuejian12.yuejian_12.javabean.FeedbackBean;
import com.neusoft.yuejian12.yuejian_12.service.FeedbackService;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

import static com.neusoft.yuejian12.yuejian_12.constant.Constant.BASE_URL;

/**
 * Created by Administrator on 2017/10/11.
 */

public class FeedbackModel {
    private Retrofit retrofit;
    public FeedbackModel(){
        retrofit = new Retrofit.Builder()
                .baseUrl(BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }
    public Call<FeedbackBean> addfeedback(int u_id,String f_title, String f_info){
        FeedbackService feedbackService = retrofit.create(FeedbackService.class);
        return feedbackService.addfeedback(u_id,f_title,f_info);
    }

//    public void addfeedback(int c_id,String f_title,String f_info,final RetrofitListener listener){
//        FeedbackService feedbackService = retrofit.create(FeedbackService.class);
//        Call call = feedbackService.addfeedback(c_id,f_title,f_info);
//        System.out.print(c_id);
//        Callback<FeedbackBean> callback = new Callback<FeedbackBean>() {
//            @Override
//            public void onResponse(Call<FeedbackBean> call, Response<FeedbackBean> response) {
//                FeedbackBean feedbackBean = response.body();
//                listener.onSuccess(feedbackBean);
//            }
//            @Override
//            public void onFailure(Call<FeedbackBean> call, Throwable t) {
//                listener.onFail();
//            }
//        };
//        call.enqueue(callback);
//
//    }
}
